function kset(key,value) 
{ 
    window.localStorage.setItem( key , value ); 
}
function kget( key ) 
{ 
    return window.localStorage.getItem( key ); 
}
function kremove( key ) 
{
    window.localStorage.removeItem( key ); 
}


//滚动
    var currentPosition,timer;
    function GoTop(){
        timer=setInterval("runToTop()",0.05);
    }
    function runToTop(){
        currentPosition=document.documentElement.scrollTop || document.body.scrollTop;
        currentPosition-=100;
        if(currentPosition>0){
            window.scrollTo(0,currentPosition);
        }else{
            window.scrollTo(0,0);
            clearInterval(timer);
            
        }
        
    }
//检测下滑
    $(window).bind('scroll', function(){    //绑定滚动事件
        if (window.location.href=='http://library.timepicker.cn/') {return false;};
        if(document.body.scrollTop == 0){
            $("#gotop").hide();
        }else{
            $("#gotop").css("display","block");
        }
    }); 
    
//弹窗
$("#loginDialog i").click(function () {$("#loginDialog").hide();$("#DialogLayer").hide();});
function SetDialogEvent(content,goon,cancel) {
    $("#changepart").html(content);
    $("#loginDialog").show();
    $("#DialogLayer").show();
    $('#btnDialogConfirm').unbind("click");
    $(".dialog #btnDialogConfirm").click(function () {
        if (typeof(goon)!='undefined') {
            eval(goon)();         
        };
        $("#loginDialog").hide();
        $("#DialogLayer").hide();
    })
    $(".dialog #btnDialogCancel").click(function () {
        if (typeof(cancel)!='undefined') {      
            var funcAA = eval(cancel);
            funcAA();
        }
        $("#loginDialog").hide();
        $("#DialogLayer").hide();
    })
    
}